﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using oAuth;
using System.Web;
namespace Twicko {
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window {
        oAuthTwitter oAuth;
        LoginWindow loginWindow;
        ApplicationWindow appWindow;
        public MainWindow() {
            InitializeComponent();
            oAuth = new oAuthTwitter();
        }

        private void button1_Click(object sender, RoutedEventArgs e) {
            loginWindow = new LoginWindow(oAuth);
            try {
                loginWindow.ShowDialog();
                if (!String.IsNullOrEmpty(oAuth.TokenSecret)) {
                    appWindow = new ApplicationWindow(oAuth);
                    this.Hide();
                    appWindow.ShowDialog();
                    this.Show();
                }
            } catch (System.Net.WebException ex) {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
